import React, { Component } from 'react'
import {
  Col,
  Table,
  Space,
  Row,
  Form,
  message,
  Tooltip,
  Input,
  Select,
  InputNumber,
  // Tag,
} from 'antd'
import {
  EditOutlined,
  // DeleteOutlined,
  PlusOutlined,
  DeleteFilled,
  // RightOutlined,
  // DownOutlined,
  // UploadOutlined,
  // DownloadOutlined,
  // InboxOutlined,
  // CheckSquareOutlined,
} from '@ant-design/icons'

// import axios from "../../rudexRou/urlHttp.js";
// import {
//   uncompileStr,
//   VerifySessionTime,
//   getCookie,
//   compileStr,
//   delCookie,
//   getResponseUrl,
//   getLinkToUrl,
//   devProTest,
//   findConfig,
//   getHeaderParams,
// } from "../../rudexRou/OperatesCookie.js";
// import { dataAxios } from "../../rudexRou/request.js";
import {
  getEmpByEmpNo,
  searchExpertList,
  editExpertInfo,
  addExpertInfo,
  deleteExpert,
} from '../../api2'
import AdvancedSearchForm from '../../componentJsx/common/searchForm'
import HasPermi from '../../componentJsx/common/hasPermi'
import NewModal from '../../componentJsx/common/NewModal'
import 'antd/dist/antd.css'
import { confirmDeptByCode } from '../../utils'
import '../../componentCss/component.css'
//字典
import { getDictionaryLabel } from '../../rudexRou/OperatesCookie.js'
// import { values } from "underscore";
// import { T } from "antd/lib/upload/utils";

class Index extends Component {
  constructor(props) {
    super(props)
    this.state = {
      bottonListLeft: [
        {
          interceptor: 'tmfs:expert:add',
          type: 'primary',
          clickFn: () => this.showModal('add'),
          icon: <PlusOutlined />,
          text: '新增',
        },
        {
          interceptor: 'tmfs:expert:del',
          type: 'danger',
          clickFn: () => this.showModal('delete'),
          text: '删除',
        },
      ],
      addModalVisible: false, //新增的模态框
      deleteModalVisible: false, //删除的模态框
      editModalVisible: false, //修改模态框
      searchEmpModalVisible: false,
      confirmLoading: false, //确认按钮异步等待
      lastLoading: false, //表格等待
      selectedRowKeys: [], //最新表格多选
      selectedRows: [],
      //分页
      total: 0,
      pageSize: 10,
      page: 1,
      //数据
      tableData: [], //最新数据
      //表格列
      tableColumns: [
        {
          title: '工号',
          dataIndex: 'empNo',
          key: 'empNo',
          width: 80,
          fixed: 'left',
          ellipsis: true,
        },
        {
          title: '姓名',
          dataIndex: 'empName',
          key: 'empName',
          width: 100,
          ellipsis: true,
          fixed: 'left',
        },
        {
          title: '地域',
          dataIndex: 'regionName',
          key: 'regionName',
          ellipsis: true,
          width: 100,
        },
        {
          title: '部门BD',
          dataIndex: 'orgBdName',
          key: 'orgBdName',
          ellipsis: true,
          width: 270,
        },
        {
          title: '部门BU',
          dataIndex: 'orgBuName',
          key: 'orgBuName',
          ellipsis: true,
          width: 270,
        },
        {
          title: '部门CU',
          dataIndex: 'orgCuName',
          key: 'orgCuName',
          ellipsis: true,
          width: 270,
        },
        {
          title: '编码语言',
          dataIndex: 'codeLanguage',
          key: 'codeLanguage',
          ellipsis: true,
          width: 300,
          render: (text) => {
            if (text) {
              const arr = text.split(',')
              const subjectsList = []
              arr.forEach((item) => {
                subjectsList.push(getDictionaryLabel('language', item))
              })
              return subjectsList.join(' , ')
            } else {
              return ''
            }
          },
        },
        {
          title: '擅长技能',
          dataIndex: 'adeptSkills',
          key: 'adeptSkills',
          ellipsis: true,
          width: 300,
          render: (text) => {
            if (text) {
              const arr = text.split(',')
              const subjectsList = []
              arr.forEach((item) => {
                subjectsList.push(getDictionaryLabel('skills', item))
              })
              return subjectsList.join(' , ')
            } else {
              return ''
            }
          },
        },

        {
          title: '软通职级',
          dataIndex: 'positionName',
          key: 'positionName',
          ellipsis: true,
          width: 160,
          render: (t) => (t ? getDictionaryLabel('positionType', t) : t),
        },

        {
          title: '可信评定次数',
          dataIndex: 'participatedEvaluationCount',
          key: 'participatedEvaluationCount',
          ellipsis: true,
          width: 110,
          align: 'center',
        },
        {
          title: '可信评定人数',
          dataIndex: 'participatedEvaluationEmpNum',
          key: 'participatedEvaluationEmpNum',
          ellipsis: true,
          width: 110,
        },
        {
          title: '纳入时间',
          dataIndex: 'joinDate',
          key: 'joinDate',
          ellipsis: true,
          width: 140,
        },

        {
          title: '纳入人',
          dataIndex: 'appendEmpName',
          key: 'appendEmpName',
          ellipsis: true,
          width: 100,
        },
        {
          title: '操作',
          dataIndex: 'handle',
          ellipsis: true,
          width: 60,
          fixed: 'right',
          align: 'center',
          render: (_, record) => (
            <Tooltip title="修改专家信息">
              <div style={{ width: 40 }}>
                <HasPermi
                  bottonData={{
                    type: 'link',
                    interceptor: 'tmfs:expert:edit',
                    clickFn: () => this.showModal('edit', record),
                    icon: <EditOutlined />,
                  }}
                />
              </div>
            </Tooltip>
          ),
        },
      ],
      //查询条件
      searchData: {},
      // 查询条件项配置
      searchForm: [
        {
          type: 'input',
          name: '工号',
          code: 'empNo',
          placeholder: '请输入员工工号',
          maxLength: 20,
        },
        {
          type: 'input',
          name: '姓名',
          code: 'empName',
          placeholder: '请输入员工姓名',
          maxLength: 20,
        },
        {
          type: 'select',
          name: '地域',
          code: 'regionNo',
          options: getDictionaryLabel('addressConfig'),
        },
        {
          type: 'cascader',
          name: '部门',
          code: 'dept',
          options: JSON.parse(
            localStorage.getItem('deptList')
              ? localStorage.getItem('deptList')
              : '[]'
          ),
        },
      ],

      empInfo: {
        empNo: null,
        empName: null,
        regionName: null,
        orgBdName: null,
        orgBuName: null,
        orgCuName: null,
      },
      empInfoList: [],
      searchEmpInput: null,
      searchEmpColumns: [
        {
          title: '工号',
          dataIndex: 'empNo',
          key: 'empNo',
          width: 80,
          fixed: 'left',
          ellipsis: true,
        },
        {
          title: '姓名',
          dataIndex: 'empName',
          key: 'empName',
          width: 100,
          ellipsis: true,
          fixed: 'left',
        },
        {
          title: '地域',
          dataIndex: 'regionName',
          key: 'regionName',
          ellipsis: true,
          width: 100,
        },
        {
          title: '部门',
          dataIndex: 'orgName',
          key: 'orgName',
          ellipsis: true,
          width: 220,
        },
        {
          title: '备注',
          dataIndex: 'remark',
          key: 'remark',
          ellipsis: true,
          width: 140,
        },
      ],
      searchSelectedRowKeys: [],
      searchSelectedRows: [],
      searchTotal: 0,
      searchCurrentPage: 1,
      searchLoading: false,
      isShowSearch: true,
    }
  }
  addForm = React.createRef() //新增评定表单
  editForm = React.createRef() //设置评定人
  searchForm = React.createRef()
  searchInput = React.createRef()

  //获取最新数据
  getData = () => {
    this.setState({ lastLoading: true })
    let searchData = this.state.searchData
    let data = {}
    for (const key in searchData) {
      if (searchData[key] || searchData[key] === 0) {
        if (key === 'dept') {
          const orgType = confirmDeptByCode(
            searchData[key][searchData[key].length - 1]
          )
          if (orgType && orgType.type == 'cu') {
            data.orgCuNo = orgType.value
          } else if (orgType && orgType.type == 'bu') {
            data.orgBuNo = orgType.value
          } else if (orgType && orgType.type == 'bd') {
            data.orgBdNo = orgType.value
          }
        } else {
          data[key] = searchData[key]
        }
      }
    }
    data.pageSize = this.state.pageSize
    data.currentPage = this.state.page
    searchExpertList(data)
      .then((res) => {
        if (res.data.code === 200) {
          // console.log(res.data);
          if (res.data.data) {
            this.setState({
              total: res.data.data.total,
              tableData: res.data.data.list,
              lastLoading: false,
              selectedRowKeys: [],
              selectedRows: [],
            })
          } else {
            this.setState({
              total: 0,
              tableData: [],
              lastLoading: false,
              selectedRowKeys: [],
              selectedRows: [],
            })
          }
        } else {
          this.setState({ lastLoading: false })
          message.error(res.data.message || '数据获取失败')
        }
      })
      .catch((err) => {
        this.setState({ lastLoading: false })
        message.error('数据获取失败')
      })
  }
  //搜索员工信息
  searchEmpInfo = (value) => {
    if (value) {
      this.setState({
        searchLoading: true,
        searchSelectedRowKeys: [],
        searchSelectedRows: [],
      })
      const param = {
        str: value,
        pageSize: 10,
        currentPage: this.state.searchCurrentPage,
      }
      getEmpByEmpNo(param)
        .then((res) => {
          if (res.data.code === 200) {
            if (res.data.data.list.length > 0) {
              res.data.data.list.forEach((item) => {
                item.remark = item.permissions ? '' : '无操作权限'
                item.orgName =
                  item.orgCuName || item.orgBuName || item.orgBdName
              })
              this.setState({
                searchLoading: false,
                empInfoList: res.data.data.list,
                searchTotal: res.data.data.total,
              })
            } else {
              this.setState({
                searchLoading: false,
                empInfoList: [],
              })
              message.warning('没找到相关人员信息!')
            }
          } else {
            this.setState({
              searchLoading: false,
            })
            message.error('查询人员信息错误!')
          }
        })
        .catch((err) => {
          this.setState({
            searchLoading: false,
          })
          message.error('查询失败')
        })
    } else {
      message.warning('请输入员工工号')
    }
  }
  //选择行
  onSelectChange = (selectedRowKeys, selectedRows) => {
    this.setState({ selectedRowKeys, selectedRows })
  }
  //修改页数changePage
  changePage = (page, pageSize) => {
    this.setState({ page, pageSize }, () => {
      this.getData()
    })
  }
  //筛选搜索
  execSearch = (data) => {
    this.setState({ searchData: data, page: 1 }, () => {
      this.getData()
    })
  }
  //设置按钮加载动画开关
  buttonLoading = (flag) => {
    this.setState({ confirmLoading: flag })
  }
  //隐藏模态框
  hiddenModal = () => {
    this.setState({
      addModalVisible: false, //新增的模态框
      deleteModalVisible: false, //删除的模态框
      editModalVisible: false, //设置评定人模态框
      confirmLoading: false, //确认按钮异步等待
      downloadModalVisible: false,
      empInfo: {
        empNo: null,
        empName: null,
        regional: null,
        departmentBD: null,
        departmentBU: null,
        departmentCU: null,
      },
      empInfoList: [],
      searchSelectedRowKeys: [],
      searchSelectedRows: [],
      searchTotal: 0,
      searchCurrentPage: 1,
    })
  }
  //显示模态框
  showModal = (name, empInfo) => {
    if (name == 'delete' && this.state.selectedRows.length <= 0) {
      message.warn('请从列表选择需要操作的员工')
      return
    }
    if (empInfo) {
      let { ..._empInfo } = empInfo
      _empInfo.codeLanguage = _empInfo.codeLanguage.split(',')
      _empInfo.adeptSkills = _empInfo.adeptSkills.split(',')

      this.setState(
        {
          empInfo: _empInfo,
          addModalVisible: name == 'add' ? true : false,
          deleteModalVisible: name == 'delete' ? true : false,
          editModalVisible: name == 'edit' ? true : false,
          downloadModalVisible: name == 'download' ? true : false,
        },
        () => {
          this.editForm.current.setFieldsValue(this.state.empInfo)
        }
      )
    } else {
      this.setState({
        addModalVisible: name == 'add' ? true : false,
        deleteModalVisible: name == 'delete' ? true : false,
        editModalVisible: name == 'edit' ? true : false,
        downloadModalVisible: name == 'download' ? true : false,
      })
    }
  }
  showSearchEmpModal = () => {
    this.setState({ searchEmpModalVisible: true })
    this.searchInput.current.blur()
  }
  hiddenSearchEmpModal = () => {
    this.setState({
      searchEmpModalVisible: false,
      searchSelectedRowKeys: [],
      searchSelectedRows: [],
    })
  }
  checkEmp = () => {
    this.addForm.current.setFieldsValue({
      addFormSearch: this.state.searchSelectedRows[0].empNo,
    })
    this.setState({
      empInfo: {
        empNo: this.state.searchSelectedRows[0].empNo,
        empName: this.state.searchSelectedRows[0].empName,
        regionName: this.state.searchSelectedRows[0].regionName,
        orgBdName: this.state.searchSelectedRows[0].orgBdName,
        orgBuName: this.state.searchSelectedRows[0].orgBuName,
        orgCuName: this.state.searchSelectedRows[0].orgCuName,
      },
      searchEmpModalVisible: false,
    })
  }
  searchTableChange = (page, pageSize) => {
    this.setState({ searchCurrentPage: page }, () => {
      this.searchEmpInfo(this.searchForm.current.getFieldsValue().searchData)
    })
  }
  onSearchSelectChange = (searchSelectedRowKeys, searchSelectedRows) => {
    this.setState({
      searchSelectedRowKeys,
      searchSelectedRows,
    })
  }
  //新增
  add = () => {
    this.addForm.current.validateFields().then((values, error) => {
      if (error) return
      this.buttonLoading(true)
      let _data = this.addForm.current.getFieldsValue()
      let data = {
        empNo: _data.addFormSearch,
        empName: this.state.empInfo.empName,
        adeptSkills: _data.skill.toString(),
        participatedEvaluationCount: _data.reviewTimes,
        participatedEvaluationEmpNum: _data.reviewPeopleTimes,
        positionName: _data.rank,
        codeLanguage: _data.lang.toString(),
      }
      addExpertInfo(data)
        .then((res) => {
          if (res.data.code === 200) {
            message.success('新增专家成功')
            this.getData()
            this.hiddenModal()
          } else {
            this.buttonLoading(false)
            message.error(res.data.message || '新增专家失败')
          }
        })
        .catch((err) => {
          this.buttonLoading(false)
          message.error('新增专家失败')
        })
    })
  }
  //删除
  delete = () => {
    if (this.state.selectedRows.length <= 0) {
      message.warn('请从列表选择需要操作的数据')
      return
    }
    this.buttonLoading(true)
    let ids = this.state.selectedRowKeys
    deleteExpert(ids)
      .then((res) => {
        if (res.data.code === 200) {
          message.success('删除专家成功')
          this.getData()
          this.hiddenModal()
        } else {
          this.buttonLoading(false)
          message.error(res.data.message || '删除专家失败')
        }
      })
      .catch((err) => {
        this.buttonLoading(false)
        message.error('删除专家失败')
      })
  }
  //修改
  edit = () => {
    this.editForm.current.validateFields().then((v, error) => {
      if (error) return
      this.buttonLoading(true)
      let data = this.editForm.current.getFieldsValue()
      data.id = this.state.empInfo.id
      data.adeptSkills = data.adeptSkills.toString()
      data.codeLanguage = data.codeLanguage.toString()
      if (!data.participatedEvaluationCount)
        data.participatedEvaluationCount = ''
      if (!data.participatedEvaluationEmpNum)
        data.participatedEvaluationEmpNum = ''
      editExpertInfo(data)
        .then((res) => {
          if (res.data.code === 200) {
            message.success('修改专家信息成功')
            this.getData()
            this.hiddenModal()
          } else {
            this.buttonLoading(false)
            message.error(res.data.message || '修改专家信息失败')
          }
        })
        .catch((err) => {
          this.buttonLoading(false)
          message.error('修改专家信息失败')
        })
    })
  }
  componentWillMount() {
    const list = JSON.parse(
      localStorage.getItem('deptList') ? localStorage.getItem('deptList') : '[]'
    )
    if (list.length === 0) {
      this.setState({
        isShowSearch: false,
      })
    }
  }
  componentDidMount() {
    this.getData()
  }
  //组件销毁时取消setState
  componentWillUnmount() {
    this.setState = (state, callback) => {
      return
    }
  }
  render() {
    //多选行配置
    const rowSelection = {
      selectedRowKeys: this.state.selectedRowKeys,
      onChange: this.onSelectChange,
    }
    const searchRowSelection = {
      selectedRowKeys: this.state.searchSelectedRowKeys,
      onChange: this.onSearchSelectChange,
      getCheckboxProps: (record) => ({
        disabled: record.permissions === false,
        name: record.name,
      }),
    }

    if (this.state.isShowSearch) {
      return (
        <div id="evaluate">
          <div className="myProjectsBody">
            <div className="bigContent1" id="projectdatail">
              <AdvancedSearchForm
                execSearch={this.execSearch}
                formData={this.state.searchForm}
              />
            </div>
            <div className="segmentationDiv"></div>
            <div className="tabstyle">
              <div className="bigContent1" id="projectdatail">
                <div className="operatingDiv">
                  <Row justify="space-between">
                    <Col span={16}>
                      <Space size={0}>
                        {this.state.bottonListLeft.map((item) => (
                          <HasPermi key={item.interceptor} bottonData={item} />
                        ))}
                      </Space>
                    </Col>
                  </Row>
                </div>
                <div className="tableDiff">
                  <Table
                    rowKey="id"
                    loading={this.state.lastLoading}
                    style={{ marginTop: 10 }}
                    scroll={{ x: '100' }}
                    rowSelection={{ type: 'checkbox', ...rowSelection }}
                    columns={this.state.tableColumns}
                    dataSource={this.state.tableData}
                    pagination={{
                      total: this.state.total,
                      pageSize: this.state.pageSize,
                      current: this.state.page,
                      showSizeChanger: true,
                      onChange: this.changePage,
                      onShowSizeChange: this.changePageSize,
                      showTotal: (total) => '共 ' + total + ' 条',
                    }}
                    bordered
                  />
                </div>
              </div>
            </div>
          </div>
          {/* 新增 */}
          <NewModal
            modalOptions={{
              width: '900px',
              title: '新增专家',
              destroyOnClose: true,
              visible: this.state.addModalVisible,
              onCancel: this.hiddenModal,
            }}
            buttonOptions={{
              position: 'center',
              btnList: [
                {
                  key: 0,
                  onClick: this.add,
                  text: '确认',
                  type: 'primary',
                  loading: this.state.confirmLoading,
                },
                {
                  key: 1,
                  onClick: this.hiddenModal,
                  text: '取消',
                },
              ],
            }}
          >
            <Form
              name="addForm"
              ref={this.addForm}
              labelAlign="right"
              labelCol={{ style: { width: 140 } }}
              size="small"
            >
              <Row>
                <Col span={24}>
                  <Form.Item
                    label="工号"
                    name="addFormSearch"
                    rules={[{ required: true, message: '请输入工号' }]}
                  >
                    <Input.Search
                      maxLength={10}
                      ref={this.searchInput}
                      placeholder="点击查询"
                      onFocus={this.showSearchEmpModal}
                      onSearch={this.showSearchEmpModal}
                    />
                  </Form.Item>
                </Col>
                <Col span={11}>
                  <Form.Item label="工号">{this.state.empInfo.empNo}</Form.Item>
                </Col>
                <Col span={11} offset={2}>
                  <Form.Item label="所属BD">
                    {this.state.empInfo.orgBdName}
                  </Form.Item>
                </Col>
                <Col span={11}>
                  <Form.Item label="姓名">
                    {this.state.empInfo.empName}
                  </Form.Item>
                </Col>
                <Col span={11} offset={2}>
                  <Form.Item label="所属BU">
                    {this.state.empInfo.orgBuName}
                  </Form.Item>
                </Col>
                <Col span={11}>
                  <Form.Item label="地域">
                    {this.state.empInfo.regionName}
                  </Form.Item>
                </Col>
                <Col span={11} offset={2}>
                  <Form.Item label="所属CU">
                    {this.state.empInfo.orgCuName}
                  </Form.Item>
                </Col>
                <Col span={11}>
                  <Form.Item
                    label="编码语言"
                    name="lang"
                    rules={[{ required: true, message: '请选择编码语言' }]}
                  >
                    <Select
                      placeholder="请选择"
                      mode="multiple"
                      optionFilterProp="label"
                      allowClear
                    >
                      {getDictionaryLabel('language').map((item) => {
                        return (
                          <Select.Option value={item.code} key={item.code}>
                            {item.label}
                          </Select.Option>
                        )
                      })}
                    </Select>
                  </Form.Item>
                </Col>
                <Col span={11} offset={2}>
                  <Form.Item
                    label="可信评定次数"
                    name="reviewTimes"
                    rules={[
                      // { required: true, message: '请输入可信评定次数' },
                      {
                        pattern: new RegExp(/^[0-9]\d*$/, 'g'),
                        message: '请输入整数',
                      },
                    ]}
                  >
                    <InputNumber
                      maxLength={10}
                      style={{ width: '100%' }}
                      min={0}
                      placeholder="请输入"
                    />
                  </Form.Item>
                </Col>
                <Col span={11}>
                  <Form.Item
                    label="擅长技能"
                    name="skill"
                    rules={[{ required: true, message: '请选择擅长技能' }]}
                  >
                    <Select
                      placeholder="请选择"
                      mode="multiple"
                      optionFilterProp="label"
                      allowClear
                    >
                      {getDictionaryLabel('skills').map((item) => {
                        return (
                          <Select.Option value={item.code} key={item.code}>
                            {item.label}
                          </Select.Option>
                        )
                      })}
                    </Select>
                  </Form.Item>
                </Col>
                <Col span={11} offset={2}>
                  <Form.Item
                    label="可信评定人数"
                    name="reviewPeopleTimes"
                    rules={[
                      // { required: true, message: '请输入可信评定人数' },
                      {
                        pattern: new RegExp(/^[0-9]\d*$/, 'g'),
                        message: '请输入整数',
                      },
                    ]}
                  >
                    <InputNumber
                      maxLength={10}
                      style={{ width: '100%' }}
                      min={0}
                      placeholder="请输入"
                    />
                  </Form.Item>
                </Col>
                <Col span={11}>
                  <Form.Item
                    label="软通职级"
                    name="rank"
                    // rules={[{ required: true, message: '请选择软通职级' }]}
                  >
                    <Select placeholder="请选择">
                      {getDictionaryLabel('positionType').map((item) => {
                        return (
                          <Select.Option value={item.code} key={item.code}>
                            {item.label}
                          </Select.Option>
                        )
                      })}
                    </Select>
                  </Form.Item>
                </Col>
                <Col span={11} offset={2}></Col>
              </Row>
            </Form>
            <NewModal
              modalOptions={{
                width: '768px',
                visible: this.state.searchEmpModalVisible,
                onCancel: this.hiddenSearchEmpModal,
              }}
              buttonOptions={{
                position: 'right',
                btnList: [
                  {
                    key: 1,
                    onClick: this.hiddenSearchEmpModal,
                    text: '取消',
                  },
                  {
                    key: 0,
                    onClick: this.checkEmp,
                    text: '确认',
                    type: 'primary',
                  },
                ],
              }}
            >
              <Form
                style={{ marginTop: 30 }}
                ref={this.searchForm}
                size="small"
              >
                <Form.Item
                  label="工号/姓名"
                  name="searchData"
                  rules={[{ required: true, message: '请输入工号或姓名查询' }]}
                >
                  <Input.Search
                    maxLength={10}
                    loading={this.state.searchLoading}
                    placeholder="请输入工号查询"
                    onSearch={(value) => {
                      this.setState({ searchCurrentPage: 1 }, () => {
                        this.searchEmpInfo(value)
                      })
                    }}
                  />
                </Form.Item>
              </Form>
              <Table
                bordered
                rowKey="empNo"
                rowSelection={{ type: 'radio', ...searchRowSelection }}
                dataSource={this.state.empInfoList}
                columns={this.state.searchEmpColumns}
                pagination={{
                  current: this.state.searchCurrentPage,
                  showSizeChanger: false,
                  size: 'small',
                  total: this.state.searchTotal,
                  onChange: this.searchTableChange,
                }}
              />
            </NewModal>
          </NewModal>
          {/* 删除 */}
          <NewModal
            modalOptions={{
              width: '400px',
              title: '删除提示',
              visible: this.state.deleteModalVisible,
              onCancel: this.hiddenModal,
            }}
            buttonOptions={{
              position: 'right',
              btnList: [
                {
                  key: 1,
                  onClick: this.hiddenModal,
                  text: '取消',
                },
                {
                  key: 0,
                  onClick: this.delete,
                  text: '确认删除',
                  type: 'primary',
                  loading: this.state.confirmLoading,
                },
              ],
            }}
          >
            <DeleteFilled
              style={{
                fontSize: '28px',
                color: '#e00',
                float: 'left',
                backgroundColor: '#f002',
                padding: 8,
                borderRadius: '50%',
              }}
            />
            <div
              style={{
                fontSize: 14,
                marginLeft: 60,
                fontWeight: 700,
                height: 44,
                lineHeight: '44px',
              }}
            >
              删除后不可恢复，请确认是否删除选中条目？
            </div>
          </NewModal>
          {/* 修改 */}
          <NewModal
            modalOptions={{
              width: '900px',
              title: '修改信息',
              destroyOnClose: true,
              forceRender: true,
              visible: this.state.editModalVisible,
              onCancel: this.hiddenModal,
            }}
            buttonOptions={{
              position: 'center',
              btnList: [
                {
                  key: 0,
                  onClick: this.edit,
                  text: '确认',
                  type: 'primary',
                  loading: this.state.confirmLoading,
                },
                {
                  key: 1,
                  onClick: this.hiddenModal,
                  text: '取消',
                },
              ],
            }}
          >
            <Form
              name="editForm"
              ref={this.editForm}
              labelAlign="right"
              labelCol={{ style: { width: 140 } }}
              size="small"
            >
              <Row>
                <Col span={11}>
                  <Form.Item label="工号">{this.state.empInfo.empNo}</Form.Item>
                </Col>
                <Col span={11} offset={2}>
                  <Form.Item label="所属BD">
                    {this.state.empInfo.orgBdName}
                  </Form.Item>
                </Col>
                <Col span={11}>
                  <Form.Item label="姓名">
                    {this.state.empInfo.empName}
                  </Form.Item>
                </Col>
                <Col span={11} offset={2}>
                  <Form.Item label="所属BU">
                    {this.state.empInfo.orgBuName}
                  </Form.Item>
                </Col>
                <Col span={11}>
                  <Form.Item label="地域">
                    {this.state.empInfo.regionName}
                  </Form.Item>
                </Col>
                <Col span={11} offset={2}>
                  <Form.Item label="所属CU">
                    {this.state.empInfo.orgCuName}
                  </Form.Item>
                </Col>
                <Col span={11}>
                  <Form.Item
                    label="编码语言"
                    name="codeLanguage"
                    rules={[{ required: true, message: '请选择编码语言' }]}
                  >
                    <Select
                      placeholder="请选择"
                      mode="multiple"
                      optionFilterProp="label"
                      allowClear
                    >
                      {getDictionaryLabel('language').map((item) => {
                        return (
                          <Select.Option value={item.code} key={item.code}>
                            {item.label}
                          </Select.Option>
                        )
                      })}
                    </Select>
                  </Form.Item>
                </Col>
                <Col span={11} offset={2}>
                  <Form.Item
                    label="可信评定次数"
                    name="participatedEvaluationCount"
                    rules={[
                      // { required: true, message: '请输入可信评定次数' },
                      {
                        pattern: new RegExp(/^[0-9]\d*$/, 'g'),
                        message: '请输入整数',
                      },
                    ]}
                  >
                    <InputNumber
                      maxLength={10}
                      style={{ width: '100%' }}
                      min={0}
                      placeholder="请输入"
                    />
                  </Form.Item>
                </Col>
                <Col span={11}>
                  <Form.Item
                    label="擅长技能"
                    name="adeptSkills"
                    rules={[{ required: true, message: '请选择擅长技能' }]}
                  >
                    <Select
                      placeholder="请选择"
                      mode="multiple"
                      optionFilterProp="label"
                      allowClear
                    >
                      {getDictionaryLabel('skills').map((item) => {
                        return (
                          <Select.Option value={item.code} key={item.code}>
                            {item.label}
                          </Select.Option>
                        )
                      })}
                    </Select>
                  </Form.Item>
                </Col>
                <Col span={11} offset={2}>
                  <Form.Item
                    label="可信评定人数"
                    name="participatedEvaluationEmpNum"
                    rules={[
                      // { required: true, message: '请输入可信评定人数' },
                      {
                        pattern: new RegExp(/^[0-9]\d*$/, 'g'),
                        message: '请输入整数',
                      },
                    ]}
                  >
                    <InputNumber
                      maxLength={10}
                      style={{ width: '100%' }}
                      min={0}
                      placeholder="请输入"
                    />
                  </Form.Item>
                </Col>
                <Col span={11}>
                  <Form.Item
                    label="软通职级"
                    name="positionName"
                    // rules={[{ required: true, message: '请选择软通职级' }]}
                  >
                    <Select placeholder="请选择">
                      {getDictionaryLabel('positionType').map((item) => {
                        return (
                          <Select.Option value={item.code} key={item.code}>
                            {item.label}
                          </Select.Option>
                        )
                      })}
                    </Select>
                  </Form.Item>
                </Col>
                <Col span={11} offset={2}></Col>
              </Row>
            </Form>
          </NewModal>
        </div>
      )
    } else {
      return (
        <div id="evaluate">
          <div className="myProjectsBody">
            <div className="tabstyle">
              <div className="bigContent1" id="projectdatail">
                <div className="operatingDiv">
                  {this.state.bottonListLeft.map((item) => (
                    <HasPermi key={item.interceptor} bottonData={item} />
                  ))}
                </div>
                <div className="tableDiff">
                  <Table
                    rowKey="id"
                    loading={this.state.lastLoading}
                    style={{ marginTop: 10 }}
                    scroll={{ x: '100' }}
                    rowSelection={{ type: 'checkbox', ...rowSelection }}
                    columns={this.state.tableColumns}
                    dataSource={this.state.tableData}
                    pagination={{
                      total: this.state.total,
                      pageSize: this.state.pageSize,
                      current: this.state.page,
                      showSizeChanger: true,
                      onChange: this.changePage,
                      onShowSizeChange: this.changePageSize,
                      showTotal: (total) => '共 ' + total + ' 条',
                    }}
                    bordered
                  />
                </div>
              </div>
            </div>
          </div>
          {/* 新增 */}
          <NewModal
            modalOptions={{
              width: '900px',
              title: '新增专家',
              destroyOnClose: true,
              visible: this.state.addModalVisible,
              onCancel: this.hiddenModal,
            }}
            buttonOptions={{
              position: 'center',
              btnList: [
                {
                  key: 0,
                  onClick: this.add,
                  text: '确认',
                  type: 'primary',
                  loading: this.state.confirmLoading,
                },
                {
                  key: 1,
                  onClick: this.hiddenModal,
                  text: '取消',
                },
              ],
            }}
          >
            <Form
              name="addForm"
              ref={this.addForm}
              labelAlign="right"
              labelCol={{ style: { width: 140 } }}
              size="small"
            >
              <Row>
                <Col span={24}>
                  <Form.Item
                    label="工号"
                    name="addFormSearch"
                    rules={[{ required: true, message: '请输入工号' }]}
                  >
                    <Input.Search
                      maxLength={10}
                      ref={this.searchInput}
                      placeholder="点击查询"
                      onFocus={this.showSearchEmpModal}
                      onSearch={this.showSearchEmpModal}
                    />
                  </Form.Item>
                </Col>
                <Col span={11}>
                  <Form.Item label="工号">{this.state.empInfo.empNo}</Form.Item>
                </Col>
                <Col span={11} offset={2}>
                  <Form.Item label="所属BD">
                    {this.state.empInfo.orgBdName}
                  </Form.Item>
                </Col>
                <Col span={11}>
                  <Form.Item label="姓名">
                    {this.state.empInfo.empName}
                  </Form.Item>
                </Col>
                <Col span={11} offset={2}>
                  <Form.Item label="所属BU">
                    {this.state.empInfo.orgBuName}
                  </Form.Item>
                </Col>
                <Col span={11}>
                  <Form.Item label="地域">
                    {this.state.empInfo.regionName}
                  </Form.Item>
                </Col>
                <Col span={11} offset={2}>
                  <Form.Item label="所属CU">
                    {this.state.empInfo.orgCuName}
                  </Form.Item>
                </Col>
                <Col span={11}>
                  <Form.Item
                    label="编码语言"
                    name="lang"
                    rules={[{ required: true, message: '请选择编码语言' }]}
                  >
                    <Select
                      placeholder="请选择"
                      mode="multiple"
                      optionFilterProp="label"
                      allowClear
                    >
                      {getDictionaryLabel('language').map((item) => {
                        return (
                          <Select.Option value={item.code} key={item.code}>
                            {item.label}
                          </Select.Option>
                        )
                      })}
                    </Select>
                  </Form.Item>
                </Col>
                <Col span={11} offset={2}>
                  <Form.Item
                    label="可信评定次数"
                    name="reviewTimes"
                    rules={[
                      // { required: true, message: '请输入可信评定次数' },
                      {
                        pattern: new RegExp(/^[0-9]\d*$/, 'g'),
                        message: '请输入整数',
                      },
                    ]}
                  >
                    <InputNumber
                      maxLength={10}
                      style={{ width: '100%' }}
                      min={0}
                      placeholder="请输入"
                    />
                  </Form.Item>
                </Col>
                <Col span={11}>
                  <Form.Item
                    label="擅长技能"
                    name="skill"
                    rules={[{ required: true, message: '请选择擅长技能' }]}
                  >
                    <Select
                      placeholder="请选择"
                      mode="multiple"
                      optionFilterProp="label"
                      allowClear
                    >
                      {getDictionaryLabel('skills').map((item) => {
                        return (
                          <Select.Option value={item.code} key={item.code}>
                            {item.label}
                          </Select.Option>
                        )
                      })}
                    </Select>
                  </Form.Item>
                </Col>
                <Col span={11} offset={2}>
                  <Form.Item
                    label="可信评定人数"
                    name="reviewPeopleTimes"
                    rules={[
                      // { required: true, message: '请输入可信评定人数' },
                      {
                        pattern: new RegExp(/^[0-9]\d*$/, 'g'),
                        message: '请输入整数',
                      },
                    ]}
                  >
                    <InputNumber
                      maxLength={10}
                      style={{ width: '100%' }}
                      min={0}
                      placeholder="请输入"
                    />
                  </Form.Item>
                </Col>
                <Col span={11}>
                  <Form.Item
                    label="软通职级"
                    name="rank"
                    // rules={[{ required: true, message: '请选择软通职级' }]}
                  >
                    <Select placeholder="请选择">
                      {getDictionaryLabel('positionType').map((item) => {
                        return (
                          <Select.Option value={item.code} key={item.code}>
                            {item.label}
                          </Select.Option>
                        )
                      })}
                    </Select>
                  </Form.Item>
                </Col>
                <Col span={11} offset={2}></Col>
              </Row>
            </Form>
            <NewModal
              modalOptions={{
                width: '768px',
                visible: this.state.searchEmpModalVisible,
                onCancel: this.hiddenSearchEmpModal,
              }}
              buttonOptions={{
                position: 'right',
                btnList: [
                  {
                    key: 1,
                    onClick: this.hiddenSearchEmpModal,
                    text: '取消',
                  },
                  {
                    key: 0,
                    onClick: this.checkEmp,
                    text: '确认',
                    type: 'primary',
                  },
                ],
              }}
            >
              <Form
                style={{ marginTop: 30 }}
                ref={this.searchForm}
                size="small"
              >
                <Form.Item
                  label="工号/姓名"
                  name="searchData"
                  rules={[{ required: true, message: '请输入工号或姓名查询' }]}
                >
                  <Input.Search
                    maxLength={10}
                    loading={this.state.searchLoading}
                    placeholder="请输入工号查询"
                    onSearch={(value) => {
                      this.setState({ searchCurrentPage: 1 }, () => {
                        this.searchEmpInfo(value)
                      })
                    }}
                  />
                </Form.Item>
              </Form>
              <Table
                bordered
                rowKey="empNo"
                rowSelection={{ type: 'radio', ...searchRowSelection }}
                dataSource={this.state.empInfoList}
                columns={this.state.searchEmpColumns}
                pagination={{
                  current: this.state.searchCurrentPage,
                  showSizeChanger: false,
                  size: 'small',
                  total: this.state.searchTotal,
                  onChange: this.searchTableChange,
                }}
              />
            </NewModal>
          </NewModal>
          {/* 删除 */}
          <NewModal
            modalOptions={{
              width: '400px',
              title: '删除提示',
              visible: this.state.deleteModalVisible,
              onCancel: this.hiddenModal,
            }}
            buttonOptions={{
              position: 'right',
              btnList: [
                {
                  key: 1,
                  onClick: this.hiddenModal,
                  text: '取消',
                },
                {
                  key: 0,
                  onClick: this.delete,
                  text: '确认删除',
                  type: 'primary',
                  loading: this.state.confirmLoading,
                },
              ],
            }}
          >
            <DeleteFilled
              style={{
                fontSize: '28px',
                color: '#e00',
                float: 'left',
                backgroundColor: '#f002',
                padding: 8,
                borderRadius: '50%',
              }}
            />
            <div
              style={{
                fontSize: 14,
                marginLeft: 60,
                fontWeight: 700,
                height: 44,
                lineHeight: '44px',
              }}
            >
              删除后不可恢复，请确认是否删除选中条目？
            </div>
          </NewModal>
          {/* 修改 */}
          <NewModal
            modalOptions={{
              width: '900px',
              title: '修改信息',
              destroyOnClose: true,
              forceRender: true,
              visible: this.state.editModalVisible,
              onCancel: this.hiddenModal,
            }}
            buttonOptions={{
              position: 'center',
              btnList: [
                {
                  key: 0,
                  onClick: this.edit,
                  text: '确认',
                  type: 'primary',
                  loading: this.state.confirmLoading,
                },
                {
                  key: 1,
                  onClick: this.hiddenModal,
                  text: '取消',
                },
              ],
            }}
          >
            <Form
              name="editForm"
              ref={this.editForm}
              labelAlign="right"
              labelCol={{ style: { width: 140 } }}
              size="small"
            >
              <Row>
                <Col span={11}>
                  <Form.Item label="工号">{this.state.empInfo.empNo}</Form.Item>
                </Col>
                <Col span={11} offset={2}>
                  <Form.Item label="所属BD">
                    {this.state.empInfo.orgBdName}
                  </Form.Item>
                </Col>
                <Col span={11}>
                  <Form.Item label="姓名">
                    {this.state.empInfo.empName}
                  </Form.Item>
                </Col>
                <Col span={11} offset={2}>
                  <Form.Item label="所属BU">
                    {this.state.empInfo.orgBuName}
                  </Form.Item>
                </Col>
                <Col span={11}>
                  <Form.Item label="地域">
                    {this.state.empInfo.regionName}
                  </Form.Item>
                </Col>
                <Col span={11} offset={2}>
                  <Form.Item label="所属CU">
                    {this.state.empInfo.orgCuName}
                  </Form.Item>
                </Col>
                <Col span={11}>
                  <Form.Item
                    label="编码语言"
                    name="codeLanguage"
                    rules={[{ required: true, message: '请选择编码语言' }]}
                  >
                    <Select
                      placeholder="请选择"
                      mode="multiple"
                      optionFilterProp="label"
                      allowClear
                    >
                      {getDictionaryLabel('language').map((item) => {
                        return (
                          <Select.Option value={item.code} key={item.code}>
                            {item.label}
                          </Select.Option>
                        )
                      })}
                    </Select>
                  </Form.Item>
                </Col>
                <Col span={11} offset={2}>
                  <Form.Item
                    label="可信评定次数"
                    name="participatedEvaluationCount"
                    rules={[
                      // { required: true, message: '请输入可信评定次数' },
                      {
                        pattern: new RegExp(/^[0-9]\d*$/, 'g'),
                        message: '请输入整数',
                      },
                    ]}
                  >
                    <InputNumber
                      maxLength={10}
                      style={{ width: '100%' }}
                      min={0}
                      placeholder="请输入"
                    />
                  </Form.Item>
                </Col>
                <Col span={11}>
                  <Form.Item
                    label="擅长技能"
                    name="adeptSkills"
                    rules={[{ required: true, message: '请选择擅长技能' }]}
                  >
                    <Select
                      placeholder="请选择"
                      mode="multiple"
                      optionFilterProp="label"
                      allowClear
                    >
                      {getDictionaryLabel('skills').map((item) => {
                        return (
                          <Select.Option value={item.code} key={item.code}>
                            {item.label}
                          </Select.Option>
                        )
                      })}
                    </Select>
                  </Form.Item>
                </Col>
                <Col span={11} offset={2}>
                  <Form.Item
                    label="可信评定人数"
                    name="participatedEvaluationEmpNum"
                    rules={[
                      // { required: true, message: '请输入可信评定人数' },
                      {
                        pattern: new RegExp(/^[0-9]\d*$/, 'g'),
                        message: '请输入整数',
                      },
                    ]}
                  >
                    <InputNumber
                      maxLength={10}
                      style={{ width: '100%' }}
                      min={0}
                      placeholder="请输入"
                    />
                  </Form.Item>
                </Col>
                <Col span={11}>
                  <Form.Item
                    label="软通职级"
                    name="positionName"
                    // rules={[{ required: true, message: '请选择软通职级' }]}
                  >
                    <Select placeholder="请选择">
                      {getDictionaryLabel('positionType').map((item) => {
                        return (
                          <Select.Option value={item.code} key={item.code}>
                            {item.label}
                          </Select.Option>
                        )
                      })}
                    </Select>
                  </Form.Item>
                </Col>
                <Col span={11} offset={2}></Col>
              </Row>
            </Form>
          </NewModal>
        </div>
      )
    }
  }
}
export default Index
